{{template "layout.html" . }}

{{define "LayoutContent"}}
    <div class="main_body" id="main_body">
        <div class="breadcrub">
            当前位置：商品管理>商品列表
        </div>
        <div class="pannel">
            <span class="sel_label">请选择商品类型：</span>
            <form id="form" method="get" action="/Article/ShowArticle">
            <select name="select" id="select" class="sel_opt">
                {{range .types}}
                    {{if compare $.typeName .Name}}
                        <option selected="true">{{.Name}}</option>
                            {{else}}
                        <option>{{.Name}}</option>
                            {{end}}
               {{end}}
            </select>
                <input type="submit" hidden="hidden">
            </form>

            <table class="common_table">
                <tr>
                    <th width="31%">商品标题</th>
                    <th width="5%">商品描述</th>
                    <th width="16%">添加时间</th>
                    <th width="7%">库存量</th>
                    <th width="10%">商品类型</th>
                    <th width="10%">商品价格</th>
                    <th width="7">销量</th>
                    <th width="7%">删除</th>
                    <th width="7%">编辑</th>

                </tr>
                {{range $index ,$val := .goods}}

                <tr>
                    <td>{{$val.Name}}</td>
                    <td><a href="/Article/ArticleContent?id={{$val.Id}}">查看详情</a></td>
                    <td> {{$val.Time.Format "2006-01-02 15:04:05"}}</td>
                    <td>{{$val.Stock}}</td>
                    <td>{{$val.ArticleType.TypeName}}</td>
                    <td>{{$val.Price}}</td>
                    <td>{{$val.Sales}}</td>
                    <td><a href="/Article/DeleteArticle?id={{$val.Id2}}" class="dels">删除</a></td>
                    <td><a href="/Article/UpdateArticle?id={{$val.Id2}}">编辑</a></td>

                </tr>
                        {{end}}
            </table>

             <ul class="pagenation">
                <li><a href="/Article/ShowArticle?pageIndex=1&select={{.typeName}}">首页</a></li>
                {{if compare .FirstPage true}}
                         <li>上一页 </li>
                {{else}}
                        <li><a href="/Article/ShowArticle?pageIndex={{.pageIndex | ShowLastPage}}&select={{.typeName}}">上一页</a></li>
                {{end}}
                 {{if compare .EndPage true}}
                         <li>下一页</li>
                         {{else}}
                <li> <a href="/Article/ShowArticle?pageIndex={{.pageIndex | ShowNextPage}}&select={{.typeName}}">下一页</a></li>
                         {{end}}
        <li><a href="/Article/ShowArticle?pageIndex={{.pageCount}}"&select={{.typeName}}>末页</a></li>
        <li>共{{.count}}条记录/共{{.pageCount}}页/当前{{.pageIndex}}页</li>
            </ul>
        </div>
    </div>
{{end}}